<?php
namespace Admin\Controller;

use Think\Page;

class ConsumerController extends CommonController
{
    public function __construct()
    {
        parent::__construct();
        $this->model = M('consumer');
    }

    public function index()
    {
        $this->display();
    }

    /**
     * 用户余额
     * @return [type] [description]
     */
    public function balance()
    {
        $this->display();
    }

    /**
     * 积分
     * @return [type] [description]
     */
    public function integral()
    {
        $this->display();
    }

    /**
     * 个人信息
     * @return [type] [description]
     */
    public function message()
    {
    	$where = [
    		'shop_id' => SHOP_ID,
    	];

    	$count = $this->model
    		->where($where)
    		->count();

    	$pages = new Page($count,C('PAGE'));

    	$list = $this->model
    		->where($where)
    		->field($pages->firstRow . ',' . $pages->listRows)
    		->select();

    	$this->assign('list',$list);
    	$this->assign('count',$count);
        $this->assign('pages', $pages->show());
        $this->assign('bread_crumb', $bread_crumb = generate_bread_crumb([
            '用户管理',
            '个人信息',
        ]));
        $this->display();
    }

    /**
     * 个人详细信息
     * @return [type] [description]
     */
    public function messageDetail()
    {
    	$where = [
    		'user_id' => I('post.user_id','','intval'),
    		'shop_id' => SHOP_ID;
    	];

    	$message_list = $this->model
    		->where($where)
    		->find();

    	$this->assign('list',$message_list);
        $this->display();
    }
}
